<?php
require_once('admin/config.php');
require_once ('include/convertm.php');
?>
<script type='text/javascript'>
    function upQuantity() {
        var sl=document.getElementById('order_quantity').value;
        if(sl<10) {
            sl++;
        }
        document.getElementById('order_quantity').value=sl;
    }
    
    function downQuantity() {
        var sl=document.getElementById('order_quantity').value;
        if(sl>1) {
            sl--;
        }
        document.getElementById('order_quantity').value=sl;
    }
    
</script>
<div class="container" style='width:570px;'>
    <div class="content" style='width:555px;'>
        <div class="box">
            <?php
            $pdo = $conn->prepare('SELECT datab_product.*, unit_name FROM datab_product JOIN datab_unit ON datab_product.unit_id=datab_unit.unit_id WHERE product_id=? LIMIT 1');
            $pdo->execute(array($_GET['product_id']));
            if ($pdo->rowCount()) {
                $data = $pdo->fetchAll();
                foreach ($data as $rowinfo) {
                    ?>
                    <div class="box-heading" style='width:527px;'><?php echo $rowinfo['product_name']; ?></div>
                    <div class="box-content" style='width:532px;'>
                        <div class="sp">
                            <div class="detail-image"><img src='image/data/<?php echo $rowinfo['product_image']; ?>'/></div>
                            <div class="detail-info-box">
                                <div class="detail-info">
                                    <font>Mã hàng:&nbsp;</font><?php echo $rowinfo['product_label']; ?>
                                    <br /><font>Tên:&nbsp;</font><?php echo $rowinfo['product_name']; ?>
                                    <br /><font>Điểm:&nbsp;</font>10
                                </div>   
                                <div class="detail-info">
                                    <font>Giá:&nbsp;</font><strong><?php echo formatMoney($rowinfo['product_price']); ?></strong>&nbsp;VNĐ/<?php echo $rowinfo['unit_name']; ?><br/>
                                    <font>Thời gian:&nbsp;</font><strong><?php echo $rowinfo['product_time']; ?></strong> phút
                                </div>
                                <div class="detail-info">
                                    <form action='addtocart.php' method='post'>
                                        <input type='hidden' name='product_id' value='<?php echo $_GET['product_id']; ?>'>
                                        <font>Số lượng:&nbsp;</font><input type='text' id='order_quantity' name='order_quantity' value='1' size='3px' />&nbsp;<a href='javascript:void(0);' onclick='upQuantity()'><img src='image/component/up.png' width='40px' height='35px' style='margin-bottom: -7px;' /></a>&nbsp;<a href='javascript:void(0);' onclick='downQuantity()'><img id='down'src='image/component/down.png' width='40px' height='35px' style='margin-bottom: -7px;' /></a><br/>
                                        <br /><br/>
                                        <div class="buy"><input type='submit' name='submit' value='THÊM VÀO ĐƠN HÀNG' style='width: 200px;'></div>
                                    </form>
                                </div>

                            </div>
                            <div class="detail-decription">THÔNG TIN MÓN ĂN<br/><?php echo $rowinfo['product_detail']; ?></div>  
                        </div>
                    </div>
                    <?php
                }
            }
            ?>
        </div>
    </div>
</div><!--==========hết container=========-->
